﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace DataTier
{
    [KnownType(typeof(Battery))]
    [KnownType(typeof(Edge))]
    [KnownType(typeof(Station))]
    [DataContract(IsReference = true)]
    public class Station
    {
        private int _stationId;
        private string _stationName;
        private string _stationAddress;
        private int _zipCode;
        private string _city;
        private List<Edge> _edges;
        private List<Battery> _batteries;
        private int _pathSum;
        private List<Station> _connection;

        #region Constructors

        public Station(int id, string name, string address, int zipCode, string city)
        {
            this._stationId = id;
            this._stationName = name;
            this._stationAddress = address;
            this._zipCode = zipCode;
            this._city = city;
            _edges = new List<Edge>();
            _batteries = new List<Battery>();
            _connection = new List<Station>();
            _pathSum = 0;



        }

        public Station(string name, string address, int zipCode, string city)
        {
            this._stationName = name;
            this._stationAddress = address;
            this._zipCode = zipCode;
            this._city = city;
            _edges = new List<Edge>();
            _batteries = new List<Battery>();
            _connection = new List<Station>();
            _pathSum = 0;

        }

        public Station(int id, string name, string address, int zipCode, string city, List<Edge> edge)
        {
            this._stationId = id;
            this._stationName = name;
            this._stationAddress = address;
            this._zipCode = zipCode;
            this._city = city;
            this._edges = edge;
            }

        public Station(int id)
        {
            this._stationId = id;
        }

        #endregion

        #region Properties

        [DataMember]
        public int StationId
        {
            get { return _stationId; }
            set { _stationId = value; }
        }

        [DataMember]
        public string StationName
        {
            get { return _stationName; }
            set { _stationName = value; }
        }

        [DataMember]
        public string StationAddress
        {
            get { return _stationAddress; }
            set { _stationAddress = value; }
        }

        [DataMember]
        public int ZipCode
        {
            get { return _zipCode; }
            set { _zipCode = value; }
        }

        [DataMember]
        public string City
        {
            get { return _city; }
            set { _city = value; }
        }

        [DataMember]
        public List<Edge> Edges
        {
            get { return _edges; }
            set { _edges = value; }
        }

        [DataMember]
        public List<Battery> Batteries
        {
            get { return _batteries; }
            set { _batteries = value; }
        }

        [DataMember]
        public int PathSum
        {
            get { return _pathSum; }
            set { _pathSum = value; }
        }

        [DataMember]
        public List<Station> Connection
        {
            get { return _connection; }
            set { _connection = value; }
        }

        //[DataMember]
        //public string Display
        //{
        //    get { return StationName + " " +PathSum.ToString(); }
        //}

        #endregion

        public override string ToString()
        {
            return _stationName + _pathSum;
        }
    }
}
